#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys.types.h>

#include "proto.h"

int fun (void * v,int c,int pos)
{
//	(*nt)(pos);
	int sd;
	sd = socket(AF_INET,SOCK_STREAM,0);
	if(sd<0)
	{
		noticppid(PRO_STATE_IDEL,pos);
		return -1;
	}
	int val=1;
	if(setsockopt(sd,SOL_SOCKET,SO_REUSEADDR,&val,sizeof(val)<0)
	{
		noticppid(PRO_STATE_IDEL,pos);
		return -1;
	}
	while(1)
	{
		noticppid(PRO_STATE_IDEL,pos);
		sleep(2);
		noticppid(PRO_STATE_BUSY,pos);
		
		printf("fun\n");
	}
}

int main(void)
{
	pool_run(fun,NULL,0,0);
	exit(0);
}
